package day6;

import java.util.Arrays;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int db[]=new int[4];
        for (int i=0;i<4;i++){
            System.out.print("请输入第"+(i+1)+"个数:");
            int num=sc.nextInt();
            db[i]=num;
        }
        System.out.println("排序前："+ Arrays.toString(db));
        for (int i=0;i<db.length;i++){
            for (int j=0;j< db.length-1-i;j++){
                if (db[j]>db[j+1]){
                    db[j]=db[j]^db[j+1];
                    db[j+1]=db[j]^db[j+1];
                    db[j]=db[j]^db[j+1];
                }
            }
        }
        System.out.println("排序后："+Arrays.toString(db));

    }
}
